package com.just.spring4.ch3.aware;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * spring aware的目的是让Bean获得spring容器的服务。
 * 若使用了spring aware,bean将和spring框架耦合
 * spring提供了很多aware接口
 * BeanNameAware
 * BeanFactoryAware
 * ApplicationContextAware  可以获得spring容器的所有服务
 * MessageSourceAware
 * ApplicationEventPublisherAware
 * ResourceLoaderAware
 */
public class AwareMain {
    public static void main(String[] args){
        AnnotationConfigApplicationContext context=new AnnotationConfigApplicationContext(AwareConfig.class);
        AwareService awareService =context.getBean(AwareService.class);
        awareService.outputResult();
        context.close();
    }
}
